<template>
  <view class="settle-container">
    <label for="" @click="changeAll">
      <radio class="good-check" :checked="isFullCheck"/>
    </label>
    <!-- 总计 -->
    <view class="total-count">
      总计：<text>&yen;{{checkedTotalPrice}}</text>
    </view>
    <!-- 计算按钮 -->
    <view class="count-btn">
      计算总价({{ checkedCount }})
    </view>
  </view>
</template>

<script>
import {mapGetters, mapMutations} from 'vuex';

export default {
  computed: {
    ...mapGetters('m_cart',['checkedCount','total','checkedTotalPrice']),
    // 判断购物车中总数量和用户选中的总数量是否相等
    isFullCheck() {
      return this.total === this.checkedCount;
    }

  },
  methods:{
    ...mapMutations('m_cart',['updateAllCheck']),
    changeAll(){
      this.updateAllCheck(!this.isFullCheck)
    }
  }

};
</script>

<style lang="scss">
.settle-container {
  width: 100%;
  height: 80rpx;
  background-color: pink;
  position: fixed;
  left: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10rpx;
  box-sizing: border-box;

  .count-btn {
    width: 200rpx;
    min-width: 200rpx;
    height: 60rpx;
    background-color: #e1251b;
    border-radius: 30rpx;
    font-size: 28rpx;
    color: #fff;
    text-align: center;
    line-height: 60rpx;
  }
}
</style>
